package com.situ.mall.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.situ.mall.entity.Cart;
import com.situ.mall.mapper.CartMapper;
import com.situ.mall.service.ICartService;

@Service
public class CartServiceImpl implements ICartService {
	@Autowired
	private CartMapper cartMapper;

	@Override
	public Cart selectByUserId(Integer userId) {
		return cartMapper.selectByUserId(userId);
	}
	
	@Override
	public Integer updateAmountByProductId(Integer quantity) {
		Integer count = cartMapper.updateAmountByProductId(quantity);
		return count;
	}

	@Override
	public Integer insertSelective(Cart record) {
		cartMapper.insertSelective(record);
		return null;
	}

	@Override
	public List<Cart> select(Integer userId) {
		
		return cartMapper.select(userId);
	}

	@Override
	public Cart selectByProductId(Integer productId) {
		
		return cartMapper.selectByProductId(productId);
	}

	@Override
	public int deleteByIsChecked(Integer userId) {
		Integer count = cartMapper.deleteByIsChecked(userId);
		return count;
	}

	
}
